package com.app.service.impl;

import com.app.mapper.suzhou.AdminUserMapper;
import com.app.model.AdminUserModel;
import com.app.service.AdminUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class AdminUserServiceImpl implements AdminUserService {
    @Autowired
    private AdminUserMapper adminUserMapper;

    @Override
    public AdminUserModel getUserByUserName(String userName, String password) {
        List<AdminUserModel> userList = adminUserMapper.getList(userName,password);
        if (userList.isEmpty()) {
            return null;
        } else {
            return userList.get(0);
        }
    }

    @Override
    public AdminUserModel getUserById(int userId) {
        return adminUserMapper.getUserById(userId);
    }

    @Override
    public void update(AdminUserModel model) {
        adminUserMapper.updateById(model);
    }

    @Override
    public int insert(AdminUserModel model) {
        return adminUserMapper.insert(model);
    }


}
